/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("qx_wxd_nr",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using VOL.Entity.DomainModels;
using VOL.Miyao.IServices;
using Orther.BLL.Miyao;
using Orther.Model.param;
using Project.Utils;
using VOL.Core.Filters;
using Microsoft.AspNetCore.Authorization;
using Orther.Model.requestparam;

namespace VOL.Miyao.Controllers
{
    public partial class qx_wxd_nrController
    {
        private readonly Iqx_wxd_nrService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        private WeixiudanBLL weixiudanBLL = new WeixiudanBLL();

        [ActivatorUtilitiesConstructor]
        public qx_wxd_nrController(
            Iqx_wxd_nrService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }

       
        //api/qx_wxd_nr/GetPageDataZjc
        [ApiActionPermission(Core.Enums.ActionPermissionOptions.Search)]
        [HttpGet, Route("GetPageDataZjc")]
        public ActionResult GetPageDataZjc(WeixiudanParam param, Pagination pagination)
        {
            TData<List<qx_wxd_nr>> obj = weixiudanBLL.GetPageList(param, pagination);
            return JsonNormal(obj);
        }

        [ApiActionPermission(Core.Enums.ActionPermissionOptions.Search)]
        [HttpGet, Route("GetSumJineJson")]
        public ActionResult GetSumJineJson(WeixiudanParam param)
        {
            TData<decimal[]> obj = weixiudanBLL.GetSumJine(param);
            return JsonNormal(obj);
        }
        
        [ApiActionPermission(Core.Enums.ActionPermissionOptions.Search)]
        [HttpGet, Route("GetListJson")]
        public async Task<ActionResult> GetListJson(WeixiudanParam param, int? topNum)
        {
            TData<List<qx_wxd_nr>> obj = await weixiudanBLL.GetList(param, topNum);
            return JsonNormal(obj);
        }

        [ApiActionPermission(Core.Enums.ActionPermissionOptions.Search)]
        [HttpGet, Route("GetObjectJson")]
        public async Task<ActionResult> GetObject(WeixiudanParam param)
        {
            TData<qx_wxd_nr> obj = await weixiudanBLL.GetObject(param);
            return JsonNormal(obj);
        }

        [ApiActionPermission(Core.Enums.ActionPermissionOptions.Update)]
        [HttpPost, Route("SaveFormJson")]
        public async Task<ActionResult> SaveFormJson([FromBody] WeixiudanParams param)
        {
            TData obj = await weixiudanBLL.SaveForm(param);
            return JsonNormal(obj);
        }

        [ApiActionPermission(Core.Enums.ActionPermissionOptions.Delete)]
        [HttpGet, Route("DeleteFrom2Json")]
        public async Task<ActionResult> DeleteFrom2(Guid id)
        {
            TData obj = await weixiudanBLL.DeleteFrom2(id);
            return JsonNormal(obj);
        }
    }
}
